<template>
	<section>
		<!--start  面包屑-->
		<div class="location">
			<el-breadcrumb separator="/">
				<el-breadcrumb-item :to="{path:'/index'}">首页</el-breadcrumb-item>
				<el-breadcrumb-item>订单</el-breadcrumb-item>
				<el-breadcrumb-item>订货单</el-breadcrumb-item>
			</el-breadcrumb>
			<help-components>
				<span slot="headText">{{vue_helpData.templateName}}</span>
				<p slot="headDescText" v-html="vue_helpData.templateRemark"></p>
				<div slot="helpContentWrap">
					<div v-for="(item,index) in vue_helpData.questionAndAnswerArray">
						<h3>{{item.templateContent}}</h3>
						<p v-html="item.templateRemark"></p>
					</div>
				</div>
			</help-components>
		</div>
		<!--start content-->
		<div class="content" id="content">

			<!--高级搜索-->
			<div class="add">
				<transition name="fade">
					<div class="modal-backdrop" v-show="vue_add"></div>
				</transition>
				<transition name="slideDown">
					<div class="specific-search" v-show="vue_add">
						<div class="search-title">
							<p>高级搜索</p>
						</div>
						<div class="form" style="float: left;">
							<ul>
								<li>
									<span style="margin-right: 2px;">订货单号</span>
									<div style="width: 356px;"><input type="" v-model="saleOrderQb.orderCode" placeholder="请输入订货单号" /></div>
								</li>
								<li>
									<span style="margin-right: 2px;">客户名称</span>
									<div style="width: 356px;"><input type="" v-model="saleOrderQb.memberBname" placeholder="请输入客户" /></div>
								</li>
								<li>
									<p class="orderDate">
										<span>下单时间</span>
										<template>
										    <el-date-picker
										      v-model="vue_value6"
										      type="daterange"
										      placeholder="选择日期范围">
										    </el-date-picker>
										 </template>
									</p>
								</li>
							</ul>

						</div>

						<p class="gaoji">
							<span style="margin-right: 23px;float: left;">订单状态</span>
							<template>
							  <el-checkbox :indeterminate="vue_isIndeterminate" v-model="vue_checkAll" @change="advSearch_orderAllChange" style="float: left;margin-right: 15px;">全选</el-checkbox>
							  <el-checkbox-group v-model="vue_checkedCities" @change="advSearch_orderAllChange2">
							    <el-checkbox v-for="city in vue_cities" :label="city.key" :value="city.key">{{city.value}}</el-checkbox>
							  </el-checkbox-group>
							</template>
						</p>

						<!--<p class="gaoji">
							<span style="margin-right: 23px;float: left;">发货状态</span>
							<template>
							  <el-radio-group v-model="radio3">
							    <el-radio :label="5">全部</el-radio>
							    <el-radio :label="6">未发货</el-radio>
							    <el-radio :label="7">部分发货</el-radio>
							    <el-radio :label="8">已发货</el-radio>
							  </el-radio-group>
							</template>
						</p>-->
						<p class="gaoji">
							<span style="margin-right: 23px;float: left;">付款状态</span>
							<template>
							  <el-checkbox :indeterminate="vue_isIndeterminate2" v-model="vue_checkAll2" @change="advSearch_payAllChange" style="float: left;margin-right: 15px;">全选</el-checkbox>
							  <el-checkbox-group v-model="vue_checkedCities2" @change="advSearch_payAllChange2">
							    <el-checkbox v-for="city in vue_cities2" :label="city.key" :key="city.key">{{city.value}}</el-checkbox>
							  </el-checkbox-group>
							</template>
						</p>
						<div class="search-btn">
							<el-button @click="advSearch_ok()" type="primary">确定</el-button>
							<el-button @click="advSearch_cancel">取消</el-button>
						</div>
					</div>
				</transition>
			</div>
			<!---->
			<!--高级搜索-->
			<div class="add">
				<transition name="fade">
					<div class="modal-backdrop" v-show="vue_shoukuan"></div>
				</transition>
				<transition name="slideDown">
					<div class="specific-search" v-show="vue_shoukuan">
							<div class="">

				    	<h3 style="margin-left: 25px;">添加收款记录</h3>
				    	<div class="daizhifu">
				    	<p><span class="select-span">订单号：{{saleOrderData.orderCode}}</span><span style="margin-left: 20px;">客户名称 : {{saleOrderData.memberBname}}【{{saleOrderData.gradeName}}】</span></p>
				    		<span>待支付:<span style="margin-left: 20px;">{{orderUnpaidMoney}}</span></span>
				    		<i><span>订单金额：{{orderTotalMoney.toFixed(2)}}</span><span>已付款:{{orderPaidMoney.toFixed(2)}}</span><span>待确认付款:{{orderConfirmMoney.toFixed(2)}}</span></i>

				    	</div>
				    	<h3 style="margin-left: 25px;margin-top: 20px;">使用资金账户付款</h3>
				    	<div class="" style="width: 400px;margin-top: 20px;float: left;">
				    		<el-form :model="vue_ruleForm" :rules="rules" ref="vue_ruleForm" label-width="100px" class="demo-ruleForm">
						    	<el-form-item label="可用余额" prop="payMoneyOnline">
								    <el-input v-model="vue_ruleForm.payMoneyOnline"></el-input>
								  </el-form-item>
							</el-form>

				    	</div>
				    	<span style="color: #888;margin-top: 30px;float: left;margin-left: 5px;">余额{{fundAvailMoney}}</span>
				    	<h3 style="margin-left: 25px;margin-top: 20px;clear: both;">客户已线下付款</h3>
				    	<div class="">
				    		<div class="" style="width: 400px;float: left;margin-top: 18px;">
				    			<el-form :model="vue_ruleForm" :rules="rules" ref="vue_ruleForm" label-width="100px" class="demo-ruleForm">
								  <el-form-item label="付款金额" prop="payMoneyOffline">
								    <el-input v-model="vue_ruleForm.payMoneyOffline"></el-input>
								  </el-form-item>
								  <el-form-item label="付款日期" required>
								    <el-col :span="11">
								      <el-form-item prop="merchantDate">
								        <el-date-picker type="datetime" placeholder="选择日期" v-model="vue_ruleForm.merchantDate" style="width: 100%;"></el-date-picker>
								      </el-form-item>
								    </el-col>

								  </el-form-item>

								  <el-form-item label="收款账号" prop="merchantSignNo" >
								    <el-select v-model="vue_ruleForm.merchantSignNo" placeholder="请选择">
								      <el-option v-for="(item,index) in vue_fundMerchantViewVoList" :label="item.bankAndAccountStr" :value="item.merchantSignNo"></el-option>
								    </el-select>
								  </el-form-item>


								</el-form>
				    		</div>
				    		<div class="wuliB" style="margin-left: 50px;">
				    			<el-form ref="form" :model="form" label-width="100px">
				    			 <el-form-item label="备注">
								    <el-input type="textarea" v-model="vue_ruleForm.remark"></el-input>
								  </el-form-item>
								</el-form>
								<el-upload
									  class="upload-demo"
									  action="https://jsonplaceholder.typicode.com/posts/"
									  :file-list="fileList">
									  <el-button size="small" type="primary">点击上传</el-button>
									  <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
									</el-upload>
				    		</div>
				    	</div>
					</div>
					<div class="search-btn">
						<el-button @click="payment" type="primary">确定</el-button>
						<el-button @click="vue_shoukuan=false">取消</el-button>
					</div>
					</div>
				</transition>
			</div>
			<!---->
			<div class="piliangCao sousuo " v-if="vue_sousuo">
				搜索结果
				<em style="font-style: normal;margin: 0px 20px;">|</em>
				<a @click="advSearch_disable"><em class="iconfont">&#xe66b;</em>清除搜索</a>
				<a @click="advSearch_enable"><em class="iconfont">&#xe62d;</em>继续搜索</a>
			</div>
			<div class="piliangCao" v-if="vue_tabactive>0 && vue_sousuo==false" >
				<em class="iconfont" @click="off" style="margin: 2px 20px;position: relative;top: 2px;cursor: pointer;">&#xe630;</em>
				已选<span>{{vue_tabactive}}</span>项<em style="font-style: normal;margin: 0px 20px;">|</em>
				<a @click="batchAuditpass"><em class="iconfont">&#xe65a;</em>订单审核</a>
				<a @click="batchFinancepass" v-if="vue_financepass"><em class="iconfont">&#xe65c;</em>财务审核</a>
				<a @click="batchOutstockpass" v-if="vue_outstockpass"><em class="iconfont">&#xe64a;</em>出库审核</a>
				<a @click="batchConfirmreceipt" v-if="vue_confirmreceipt"><em class="iconfont">&#xe659;</em>发货审核</a>
			</div>
			<div class="public-th clearfix" v-if="vue_tabactive==0">
				<div class="public-left clearfix">
					<div class="slideBtn fl" >
						<el-select v-model="saleOrderQb.dataBillstate" @change="handleCommand" placeholder="全部订单">
							<el-option label="全部订单" value="">
								<span style="font-size:12px ;">全部订单</span>
							</el-option>
							<el-option v-for="item in vue_options"
								:key="item.ddlistKey"
								:label="item.ddlistName"
								:value="item.ddlistKey">
							</el-option>
						</el-select>
					</div>
					<div class="public-left clearfix">
						<div class="goods-input">
							<input @keydown.enter="generalSearch_ok" type="text" v-model="saleOrderQb.fullTextFilterStr" placeholder="请输入订单号/客户名称" /><i @click="generalSearch_ok"></i>
						</div>
					</div>
					<span class="fl search-openBtn" id="search-openBtn" @click="vfun_gaoji">高级搜索</span>
				</div>
				<div class="public-right clearfix">
					<!--<a>导出</a>
					<a>导入</a>-->
					<router-link to="/addorder" style="background: #13c19f;color: #fff;border: 0;">新增</router-link>
				</div>
			</div>
			<div class="table contentBodyCon kehutable" :class="{beforeNone:saleOrderSet.list.length!='0'}" id="table">
				<el-table
				ref="multipleTable"
				:data="saleOrderSet.list"
				style="width: 100%;  z-index: 10;"
				:max-height="vue_tableH"
				@sort-change="vFun_sort"
				@selection-change="row_handleSelectionChange">
					<el-table-column type="selection" width="30"></el-table-column>
					<el-table-column prop="orderCode" label="订单号" sortable  min-width="200"  to="/modifykehu">
						<template scope="scope">
              				<p class="pkehuName">
								<span @click="modify(scope.row)" v-html="scope.row.orderCode"></span> <span class="orderApplySpecial" v-if="scope.row.orderApplySpecial == 1">特价</span>
							</p>
						</template>
					</el-table-column>
					<el-table-column prop="createDateStr" label="下单时间" sortable  min-width="200"></el-table-column>
					<el-table-column prop="memberBname" label="客户名称" sortable min-width="140"></el-table-column>
					<el-table-column prop="orderTotalMoney" label="金额" min-width="140"></el-table-column>
					<el-table-column prop="dataBillstateStr" label="状态"   min-width="140" sortable>
						<template scope="scope">
                        	<p>
								<span v-bind:class="{daishenhe:scope.row.dataBillstateStr!='交易完成'}" v-html="scope.row.dataBillstateStr"></span>
							</p>
						</template>
					</el-table-column>
					<el-table-column prop="orderPayStateStr" label="付款状态"  min-width="140"> </el-table-column>
					<el-table-column prop="orderBuyRemark" label="备注"  min-width="140">
            <template scope="scope">
              <p class="remark">{{scope.row.orderBuyRemark}}</p>
            </template>
          </el-table-column>
					<el-table-column prop="" label="" fixed="right" width="60" >
						<template scope="scope">
							<el-popover trigger="hover" placement="bottom">
								<!--<p class="p" style="cursor: pointer;" v-if="scope.row.dataBillstateStr=='待财务审核'" @click="qiyong(scope.$index, tableData)">
									<em class="iconfont">&#xe65a;</em>审核
								</p>-->
								<p class="p" style="cursor: pointer;" @click="modify(scope.row)">
									<em class="iconfont">&#xe656;</em>订单详情
								</p>
								<p class="p" style="cursor: pointer;" @click="addjilu(scope.$index, saleOrderSet.list,scope.row.orderCode,scope.row.memberBname)">
									<em class="iconfont">&#xec52;</em>添加收款记录
								</p>
								<div slot="reference" class="name-wrapper" style="text-align: center;">
									<em class="iconfont tab-hover">&#xe607;</em>
								</div>
							</el-popover>
						</template>
					</el-table-column>
				</el-table>
			</div>
			<div class="block">
				<el-pagination
					@size-change="page_handleSizeChange"
					@current-change="page_handleCurrentChange"
					:current-page="parseInt(saleOrderSet.pageTools.pageNo)"
					:page-sizes="saleOrderSet.pageTools.pageSizeOptions"
					:page-size="parseInt(saleOrderSet.pageTools.pageSize)"
					:total="parseInt(saleOrderSet.pageTools.recordCount)"
					layout="total, prev, pager, next, sizes,jumper">
				</el-pagination>
			</div>
		</div>
		<!--end content-->
	</section>
</template>

<script>
//	const cityOptions = ['待订单审核', '待财务审核', '待出库审核', '待发货确认','已完成','已作废'];

	const cityOptions = [{"key":"1","value":"订单待审核"},{"key":"2","value":"待财务审核"},{"key":"3","value":"待出库审核"},{"key":"4","value":"待发货确认"},{"key":"5","value":"待收货确认"},{"key":"6","value":"交易完成"},{"key":"-1","value":"已撤销"}];
	const cityOptions2 = [{"key":"0","value":"未付款"},{"key":"1","value":"付款待审核"},{"key":"2","value":"部分付款"},{"key":"3","value":"已付款"}];
	import helpComponents from '../../../components/help/help'
	export default {
		components:{helpComponents},
		data() {
			return {
				vue_helpData:{
					templateName:"",
					templateRemark:"",
					questionAndAnswerArray:[]
				},

				vue_shoukuan:false,
				vue_tableH: null,
				vue_add: false,
				vue_show: true,
				vue_sousuo: false,
				vue_allOrder: false,
				vue_tabactive:'',						// 全选

				vue_saleOrderViewVo:{},				// 订单对象
				vue_fundMerchantViewVoList:[],		//收款账号集合
				vue_ruleForm: {
			        merchantListMoney: '',
			        region: '',
			        merchantDate:'',			//付款日期
			        merchantSignNo:'',			//收款账号
       		 	},

				vue_options: [],						// 高级搜索客户级别
				//ddlistKey: '',						// 高级搜索客户级别
				vue_rechargeCodeStr:"",                 // 多选框选中值
//				slideCode:'',
				//radio2: '',							// 高级搜索单选
				//radio3: '',
				vue_value6: [],							// 高级搜索日期范围
				vue_checkAll: false,					// 高级搜索全选
		        vue_checkedCities: [],					// 高级搜索全选
		        vue_cities: cityOptions,				// 高级搜索全选
		        vue_isIndeterminate: false,				// 高级搜索全选


		        vue_checkAll2: false,					// 高级搜索全选
		        vue_checkedCities2: [],					// 高级搜索全选
		        vue_cities2: cityOptions2,				// 高级搜索全选
		        vue_isIndeterminate2: false,			// 高级搜索全选

		        vue_saleOrderParamKey:"SaleOrder001",   //订货流程设置key
                vue_saleOrderBasicParamViewVo:"",       //订货流程自定义对象
                vue_saleOrderParamValueMap:"",          //订货流程
		        vue_financepass:true,                   //财务审核是否显示
				vue_outstockpass:true,                  //出库审核是否显示
				vue_confirmshipment:true,               //发货确认是否显示
				vue_confirmreceipt:true,                //收货确认是否显示
				vue_Fdate:'',						// 发货日期
            num:'',
       		 	fileList: [], //上传文件列表
       		 	form: {},     //备注和上传文件
       		 	saleOrderSet: {
					"list":[],  //数据列表
				    "page":{},	//分页数据
					"sumInfo":{}, //汇总信息
				},
				saleOrderData:{         //订单和资金信息

				},
				orderTotalMoney:0,             //订单资金信息
				orderUnpaidMoney:0,
				orderPaidMoney :0,
				orderConfirmMoney:0,
				fundAvailMoney:0,

       		 	saleOrderQb:{
					"orderCode":"",
					"memberBname":"",
					"deliverySummary":"",
					"dataBillstate":"",
					"orderPayState":"",
					"supStartDate":"",
					"supEndDate":"",
					"fullTextFilterStr":"",
					"orderStr":"",
			    },

		        rules: {
		          name: [
		            { required: true, message: '请输入金额', trigger: 'blur' },
		          ],
		          date1: [
		            { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
		          ]
		        },
			}
		},
		methods: {

//-----------------------添加收款记录---------------------------------

	    	vFun_sort(type){
	    		if(type.order==='ascending'){
	    			this.saleOrderQb.orderStr=type.prop
	    		}else if(type.order==='descending'){
	    			if(type.prop=='createDateStr'){
	    				this.saleOrderQb.orderStr='createDate desc'
	    			}else{
	    				this.saleOrderQb.orderStr=type.prop +' desc'
	    			}
	    		}else{
	    			this.saleOrderQb.orderStr=''
	    		};
	    		this.queryByPage();
	    	},
//-----------------------添加收款记录---------------------------------

			payment(){
				this.axios({
					method: 'PATCH',
					url: "/v3/sale/orders/payment",
					data:{

						"orderUnpaidMoney":this.orderUnpaidMoney,					//未支付金额
						"fundAvailMoney":this.fundAvailMoney,						//订单总金额
						"payMoneyOnline":this.vue_ruleForm.payMoneyOnline,
						"payMoneyOffline":this.vue_ruleForm.payMoneyOffline,
						"remark":this.vue_ruleForm.remark,
						"merchantListFromCode":this.saleOrderData.orderCode,			// 订单编号
						"merchantDate":this.vue_ruleForm.merchantDate,				// 付款时间
						"merchantSignNo":this.vue_ruleForm.merchantSignNo			// 收款账号
					}
				}).then((res) => {
					this.vue_shoukuan=false;
					this.Public.openSuccess(this,"操作成功！");
					this.$router.push({path:'/orderDatalis'});
				}).catch((err)=>{
					this.Public.openError(this,err.response.data);
			    });

			},
//------------------订单状态和付款状态选择-----------------------------------------
			 advSearch_orderAllChange(event) {          // 高级搜索全选
		        this.vue_checkedCities = event.target.checked ? ["1","2","3","4","5","6","-1"] : [];
		       	this.saleOrderQb.dataBillstate = "";
		        this.vue_isIndeterminate = false;
		      },
		      advSearch_orderAllChange2(value) {	// 取消高级搜索全选
		      	var dataBillstateStr = "";
		      	for(var i=0; i<value.length; i++){
		      		if(dataBillstateStr == ""){
		      			dataBillstateStr = value[i];
		      		}else{
		      			dataBillstateStr += ","+value[i];
		      		}
		      	}
		      	this.saleOrderQb.dataBillstate = dataBillstateStr;

		        let checkedCount = value.length;
		        this.vue_checkAll = checkedCount === this.vue_cities.length;
		        this.vue_isIndeterminate = checkedCount > 0 && checkedCount < this.vue_cities.length;
		      },


		       advSearch_payAllChange(event) {      // 高级搜索全选
		        this.vue_checkedCities2 = event.target.checked ? ["0","1","2","3"] : [];
		        this.saleOrderQb.orderPayState = "";
		        this.vue_isIndeterminate2 = false;
		      },
		      advSearch_payAllChange2(value) {		//取消高级搜索全选
		      	var orderPayStateStr = "";
		      	for(var i=0; i<value.length; i++){
		      		if(orderPayStateStr == ""){
		      			orderPayStateStr = value[i];
		      		}else{
		      			orderPayStateStr += ","+value[i];
		      		}
		      	}
		      	this.saleOrderQb.orderPayState = orderPayStateStr;
		        let checkedCount2 = value.length;
		        this.vue_checkAll2 = checkedCount2 === this.vue_cities2.length;
		        this.vue_isIndeterminate2 = checkedCount2 > 0 && checkedCount2 < this.vue_cities2.length;
		      },
//----------------------订单复选框选择--------------------------------
			row_handleSelectionChange(val) {
				this.multipleSelection = val;
				this.vue_tabactive=val.length;
		        //获取选中值
		        this.vue_rechargeCodeStr = "";
				for(let i=0,len=val.length;i<len;i++){
					this.vue_rechargeCodeStr += val[i].orderCode+","
				}
				this.vue_rechargeCodeStr = this.vue_rechargeCodeStr.substring(0,this.vue_rechargeCodeStr.length-1);
				if (this.vue_tabactive!=0) {
					this.vue_sousuo=false
				}
			},
//----------------关闭已选订单---------------------------------
			off(){
				this.vue_tabactive = '';
				this.vue_show=true;
				this.$refs.multipleTable.clearSelection()
			},
//------------------分页------------------------------------------
			page_handleSizeChange(val) {

				this.saleOrderSet.pageTools.pageSize = val;
				this.queryByPage();
			},
			page_handleCurrentChange(val) {

				this.saleOrderSet.pageTools.pageNo = val;
				this.queryByPage();
			},
//-----------------模糊搜索------------------------------------------
			generalSearch_ok() {
//				this.saleOrderSet.pageTools = this.$store.state.page;
				this.queryByPage();
				console.log(this.saleOrderQb.fullTextFilterStr)
			},

//----------------------查询订单信息-----------------------------------
			queryByPage(){
				this.axios({
					method: 'post',
					url: "/v3/sale/orders/list",
					data:{
						"orderCode":this.saleOrderQb.orderCode,
						"memberBname":this.saleOrderQb.memberBname,
						"deliverySummary":this.saleOrderQb.deliverySummary,
						"dataBillstate":this.saleOrderQb.dataBillstate,
						"orderPayState":this.saleOrderQb.orderPayState,
						"supStartDate":this.saleOrderQb.supStartDate,
						"supEndDate":this.saleOrderQb.supEndDate,
						"fullTextFilterStr":this.saleOrderQb.fullTextFilterStr,
						"offset":(this.saleOrderSet.pageTools.pageNo-1)*this.saleOrderSet.pageTools.pageSize,
                		"limit":this.saleOrderSet.pageTools.pageSize,
                		"orderStr":this.saleOrderQb.orderStr,
					}
				}).then((res) => {
					this.saleOrderSet.list = res.data.list;
					for(var i=0; i<this.saleOrderSet.list.length; i++){
						if(!isNaN(this.saleOrderSet.list[i].orderTotalMoney)){
							this.saleOrderSet.list[i].orderTotalMoney = this.saleOrderSet.list[i].orderTotalMoney.toFixed(2);
						}
				    }
          			this.saleOrderSet.sumInfo = res.data.sumInfo;
          			this.saleOrderSet.pageTools = res.data.pageTools;
           			this.saleOrderSet.pageTools.pageSizeOptions = JSON.parse(this.saleOrderSet.pageTools.pageSizeOptions);
				}).catch((err)=>{
					this.Public.openError(this,err.response.data);
		    	});

			},

//-------------------订单审核--------------------------------
			batchAuditpass(){
				 this.$confirm('确定订单审核通过？', '确认', {
			          	confirmButtonText: '确定',
				        cancelButtonText: '取消',
				        cancelButtonClass:"fr",
				        confirmButtonClass:"fr",
				    }).then(() => {
						this.axios({
							method: 'PATCH',
								url: "/v3/sale/orders/"+ this.vue_rechargeCodeStr +"/batchAuditpass",
						}).then((res) => {
								this.queryByPage();
								this.Public.openSuccess(this,"操作成功！");
		    			});
			        }).catch((err)=>{
						this.Public.openError(this,err.response.data);
		    		});
			},

//-------------------财务审核----------------------------------------
			batchFinancepass(){
				this.$confirm('确定财务审核通过？', '确认', {
			          	confirmButtonText: '确定',
				        cancelButtonText: '取消',
				        cancelButtonClass:"fr",
				        confirmButtonClass:"fr",
				    }).then(() => {
						this.axios({
							method: 'PATCH',
								url: "/v3/sale/orders/"+ this.vue_rechargeCodeStr +"/batchFinancepass",
						}).then((res) => {
								this.queryByPage();
								this.Public.openSuccess(this,"操作成功！");
		    			});
			        }).catch((err)=>{
							this.Public.openError(this,err.response.data);
		    			});
			},

//----------------------出库审核----------------------------------------
			batchOutstockpass(){
				this.$confirm('确定出库审核通过？', '确认', {
			          	confirmButtonText: '确定',
				        cancelButtonText: '取消',
				        cancelButtonClass:"fr",
				        confirmButtonClass:"fr",
				    }).then(() => {
						this.axios({
							method: 'PATCH',
							url: "/v3/sale/orders/"+ this.vue_rechargeCodeStr +"/batchOutstockpass",
							param:{
								"warehouseCode":""
							}
						}).then((res) => {
								this.queryByPage();
								this.Public.openSuccess(this,"操作成功！");
		    			});
				    }).catch((err)=>{
							this.Public.openError(this,err.response.data);
		    			});

			},

//------------------------发货确认------------------------------------------
			batchConfirmreceipt(){
				this.$confirm('确定发货审核通过？', '确认', {
			          	confirmButtonText: '确定',
				        cancelButtonText: '取消',
				        cancelButtonClass:"fr",
				        confirmButtonClass:"fr",
				    }).then(() => {
						this.axios({
							method: 'PATCH',
						    url: "/v3/sale/orders/"+ this.vue_rechargeCodeStr +"/batchConfirmreceipt",
						}).then((res) => {
							this.queryByPage();
							this.Public.openSuccess(this,"操作成功！");
						});
				    }).catch((err)=>{
							this.Public.openError(this,err.response.data);
		    			});
			},

//--------------------------添加收款记录------------------------------------------
			addjilu(data,tableData,orderCode,memberBname){
				this.vue_ruleForm.merchantDate=Date.now();
				this.vue_shoukuan=true;
				//查询订单和当前资金账户详情
					this.axios({
						method: 'POST',
						url: "/v3/sale/orders/"+ orderCode +"/queryOrderAndFud",
						data:{}
					}).then((res) => {
						    this.saleOrderData = res.data;
							this.orderTotalMoney = res.data.orderTotalMoney;					// 订单金额
							this.orderPaidMoney = res.data.orderPaidMoney;						// 已付款
							this.orderConfirmMoney = res.data.orderConfirmMoney;				// 待确认
							this.orderUnpaidMoney = res.data.orderUnpaidMoney.toFixed(2);		// 待支付
							this.fundAvailMoney = res.data.fundAvailMoney.toFixed(2);			// 账户余额

							if(res.data.fundAvailMoney>res.data.orderUnpaidMoney){
								this.vue_ruleForm.payMoneyOnline=this.orderUnpaidMoney;    		//可用余额输入框回显
							}else{
								this.vue_ruleForm.payMoneyOnline=this.fundAvailMoney; 			//可用余额输入框回显
								this.vue_ruleForm.payMoneyOffline=(this.orderUnpaidMoney-this.vue_ruleForm.payMoneyOnline).toFixed(2);//付款金额输入框回显
							}
					}).catch((err)=>{
						this.Public.openError(this,err.response.data);
					});
			},
//--------------------跳转订单详情--------------------------------
			modify(data) {
				localStorage.setItem("activeName","first");
				localStorage.setItem("orderCode",data.orderCode);
				localStorage.setItem("dataBillstateStr",data.dataBillstateStr);
				this.$router.push({path:'/orderDatalis'});
			},
//--------------------根据订单状态进行查询-----------------------------
      handleCommand(){
            	this.saleOrderSet.pageTools = this.$store.state.page;
            	this.queryByPage();
            },
//---------------------高级搜索-------------------------------------
			advSearch_ok() {	//高级搜索
				var supStartDate = "";
				var supEndDate = "";
				if(this.vue_value6 != null && this.vue_value6 != ""){
					this.saleOrderQb.supStartDate = this.vue_value6[0];
					this.saleOrderQb.supEndDate = this.vue_value6[1];
				}
        		this.saleOrderQb.fullTextFilterStr='';
				this.queryByPage();
				this.vue_add = !this.vue_add;
				this.vue_sousuo=true;
				this.vue_tabactive="2";
			},
			advSearch_disable(){						//清除搜索
				this.vue_tabactive=0;
					this.vue_sousuo=false;
          			this.saleGoodsQb.fullTextFilterStr = "";
					this.saleOrderQb.orderCode='';
					this.saleOrderQb.memberBname='';
					this.saleOrderQb.deliverySummary='';
					this.saleOrderQb.orderPayState='';
					this.saleOrderQb.dataBillstate='';
					this.saleOrderQb.supStartDate = null;
					this.saleOrderQb.supEndDate = null;

					this.vue_checkedCities = [];
					this.vue_checkedCities2 = [];
					this.vue_checkAll = false;
					this.vue_checkAll2 = false;
					this.queryByPage();
				},
			advSearch_enable(){						//继续搜索
			//	this.vue_value6=this.timecun;
				this.vue_add = true;

			},
			vfun_gaoji(){
				this.vue_add=true;
				this.saleOrderQb.orderCode='';
				this.saleOrderQb.memberBname='';
				this.saleOrderQb.deliverySummary='';
				this.saleOrderQb.dataBillstate=''
			},
			// 取消高级查询
			advSearch_cancel() {
				this.vue_sousuo = false;
				this.vue_add = !this.vue_add;
				this.vue_tabactive = 0;
//				this.saleOrderQb.orderCode='';
//				this.saleOrderQb.memberBname='';
//				this.saleOrderQb.deliverySummary='';
//				this.saleOrderQb.orderPayState='2';
//				this.saleOrderQb.dataBillstate=''
			},
//--------------------订单流程自定义配置数据-------------------------
            query_paramValue(){
            	/*1说明流程存在反之则说明不存在*/
            	this.axios({
	              method: 'GET',
	              url: "/v3/basic/params/"+this.vue_saleOrderParamKey,
	              data: {}
	            }).then((res) => {
            		this.vue_saleOrderParamValueMap = res.data.paramValueMap;
            		this.vue_saleOrderBasicParamViewVo = res.data;
            		if(res.data.paramValueMap!=null && res.data.paramValueMap!=""&&res.data.paramValueMap!=undefined){
            			this.vue_saleOrderParamValueMap["financepass"]==0?this.vue_financepass=false:this.vue_financepass=true;
            			this.vue_saleOrderParamValueMap["outstockpass"]==0?this.vue_outstockpass=false:this.vue_outstockpass=true;
            			this.vue_saleOrderParamValueMap["confirmshipment"]==0?this.vue_confirmshipment=false:this.vue_confirmshipment=true;
            			this.vue_saleOrderParamValueMap["confirmreceipt"]==0?this.vue_confirmreceipt=false:this.vue_confirmreceipt=true;
            		}
	            });
            },
//-------------------查询客户级别信息-----------------------------------
            query_systemDdlist(){
            	this.axios({
					method: 'post',
					url: "/v3/system/ddlists/00100000021/listAll",
					data:{
						"ddlistKey":"-1,1,2,3,4,5,6",
					},
				}).then((res) => {
					this.vue_options = res.data.list;
					this.cityOptions = res.data.list;
				}).catch((err)=>{
					this.Public.openError(this,err.response.data);
				});
            },
//-------------------查询帮助信息----------------------------------------
            query_systemTemplate(){
				this.axios({
					method:"GET",
					url:"/v3/system/templates/001000000015"
				}).then((res)=>{
						this.vue_helpData.templateName = res.data.templateName;
						this.vue_helpData.templateRemark = res.data.templateRemark;
						this.vue_helpData.questionAndAnswerArray = res.data.questionAndAnswerArray;
				}).catch((err)=>{
					this.Public.openError(this,err.response.data)
				})
			},
//---------------------查询所有收款账号-------------------------------
			query_fundMerchant(){
				this.axios({
					method: 'POST',
					url: "/v3/fund/merchants/listAll",
					data:{}
				}).then((res) => {
					this.vue_fundMerchantViewVoList = res.data.list;
				}).catch((err)=>{
					this.Public.openError(this,err.response.data);
				});
			}
		},
		created(){
			this.saleOrderSet.pageTools = this.$store.state.page;
      this.saleOrderQb.dataBillstate=localStorage.getItem("num");
		},
		mounted() {
			this.queryByPage();         // 请求订单列表
			this.query_systemDdlist();  // 获取订单状态字典
			this.query_fundMerchant();  //查询所有收款账号
			this.query_paramValue();     //获取流程配置数据
			this.query_systemTemplate();    //帮助功能
			// 设置窗口高度
			var winHieg = document.documentElement.clientHeight;
			var cont = document.getElementById("content");
			cont.style.height = winHieg - 115 + "px";
			this.vue_tableH = document.documentElement.clientHeight - 240;
			document.querySelector('body').onclick = () => {
				if(this.vue_allOrder == true) {
					this.vue_allOrder = false;
				}
			};
		},
	}
</script>

<style scoped>
	@import "../../../assets/css/zijin.css";
	.location {
		padding: 3px 0 15px 0;
	}

  .remark{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 120px;
  }

	.content {
		background: #fff;
		padding: 15px;
		overflow-y: auto;
		font-family: "微软雅黑";
		position: relative;
	}

	.public-th {
		min-width: 750px;
		position: relative;
		z-index: 100;
	}

	.public-left {
		float: left;
	}

	.public-left a,
	.public-left span.search-openBtn {
		display: block;
		float: left;
		margin-right: 10px;
		padding-right: 0px;
		position: relative;
		height: 36px;
		line-height: 36px;
		z-index: 100;
		cursor: pointer;
	}

	.goods-input input {
		display: block;
		float: left;
		width: 400px;
		height: 34px;
		font-size: 12px;
		border: 0;
		margin-left: 20px;
	}

	.public-right {
		float: right;
		overflow: hidden;
	}

	.public-right a {
		display: block;
		float: left;
		margin-left: 10px;
		width: 80px;
		height: 32px;
		box-sizing: border-box;
		text-align: center;
		line-height: 32px;
		border-radius: 30px;
		border: 1px solid #cdd9e6;
		cursor: pointer;
	}

	.public-left a:hover {
		text-decoration: none;
	}

	.public-left a em {
		display: inline-block;
		position: relative;
		font-size: 14px;
	}

	.return-goods .public-left a i {
		position: static;
		width: 20px;
		height: 36px;
		line-height: 36px;
		text-align: center;
		background: none;
		background-size: 18px;
		-webkit-transition: .2s;
		transition: .2s;
		vertical-align: middle;
	}

	.public-right a:hover {
		text-decoration: none;
	}

	.public-add {
		background: #13C19F;
		border: 1px solid #13C19F;
		color: #fff;
	}

	.public-add:hover {
		color: #fff;
		opacity: 0.8;
		-webkit-transition: 0.5s;
		transition: 0.5s;
	}

	.goods-fen1 {
		position: absolute;
		background: #fff;
		padding: 20px 0;
		overflow: hidden;
		margin-top: -3px;
		box-shadow: 0px 0px 2px #ccc;
	}

	.goods-fen1 li {
		height: 35px;
		line-height: 35px;
		width: 120px;
		text-indent: 20px;
	}


	.goods-input {
		float: left;
		width: 450px;
		border: 1px solid #cdd9e6;
		border-radius: 30px;
		margin-right: 10px;
		cursor: pointer;
	}

	.goods-input:hover {
	/*	border-color: #13C19F;*/
		transition: 1s;
	}

	.goods-input i {
		cursor: pointer;
	}


	.table {
		margin-top: 15px;
	}

	.table th {
		height: 50px;
	}

	.el-table th>.cell {
		word-wrap: normal;
		text-overflow: ellipsis;
		line-height: 20px;
		width: 100%;
		box-sizing: border-box;
		font-weight: normal!important;
		font-size: 14px;
	}

	.el-table {
		font-size: 12px!important;
		font-weight: normal!important;
	}

	.block {
		float: right;
		margin: 15px;
	}

	.fade-enter-active,
	.fade-leave-active {
		transition: opacity .3s
	}

	.fade-enter,
	.fade-leave-active {
		/*transform: translateY(-100px);*/
		opacity: 0
	}

	.tab-hover {
		color: #b7c6d6;
		cursor: pointer;
	}

	.el-tag {
		background-color: inherit;
		color: #b7c6d6;
	}

	.el-popover {
		min-width: 100px;
	}
	.pkehuName span{
		cursor: pointer;
	}

	.pkehuName span:hover{
		color: #03B8CC;
	}
	.p {
		text-indent: 10px;
		line-height: 30px;
		padding-right:10px;
	}

	.p em {
		position: relative;
		top: 2px;
		margin-right: 3px;
	}

	.p:hover {
		background: #eef1f9;
		color: #03B8CC;
	}
	.piliangCao{
		margin-left: -6px;
		height: 36px;
		line-height: 36px;
	}
	.piliangCao em {
		font-size: 14px;
	}

	.piliangCao a {
		cursor: pointer;
		color: #768696;
		margin-right: 20px;
	}
	.piliangCao a:hover{
		color: #03B8CC;
	}
	.el-table--fit {
		border-left: 0;
	}

	.textR {
		text-align: right;
	}

	.font12 {
		font-size: 12px;
	}

	.setbtn {
		margin-left: 30px;
	}

	.modal-backdrop {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 80;
		background-color: rgba(240, 240, 240, 0.2);
	}

	.specific-search {
		position: absolute;
		width: 100%;
		top: 0;
		left: 0;
		padding: 30px;
		z-index: 1005;
		background: #fff;
		box-sizing: border-box;
		box-shadow: 0 0 10px #ccc;
	}

	.search-title {
		font-size: 16px;
		border: 0;
		color: #415161;
	}

	.form {
		width: 1000px;
		background: #fff;
		margin: 20px 0;
	}

	.search-btn {
		margin-top: 40px;
	}

	.specific-search {}

	.fade-enter-active,
	.fade-leave-active {
		transition: .4s;
	}

	.fade-enter,
	.fade-leave-active {
		opacity: 0;
	}

	.slideDown-enter-active,
	.slideDown-leave-active {
		transition: .4s;
	}

	.slideDown-enter,
	.slideDown-leave-active {
		height: 0;
		opacity: 0;
	}

	.form {
		width: 450px;
		text-align: right;
	}

	.form li {
		margin-top: 15px;
	}

	.form input {
		width: 350px;
		height: 32px;
		border: 1px solid rgb(191, 212, 217);
		border-radius: 4px;
		text-indent: 5px;
	}

	.form div {
		width: 358px;
		height: 34px;
		border-radius: 4px;
		text-indent: 5px;
		margin-left: 12px;
		display: inline-block;
		position: relative;
	}
	.gaoji{
		margin-left: 28px;
		margin-bottom: 30px;
		clear: both;
	}
	.gjxzrq{
		margin-top: 30px;
		float: left;margin-left: 270px;
	}

	.slideBtn .el-input__icon+.el-input__inner{
		padding-right: 0px;
    	width: 100px;
	}
	.daishenhe{
		color: #f00;
	}
	.sousuo{
		margin-left: 10px;
		line-height: 36px;
	}
	.daizhifu{
		box-sizing: border-box;
		margin-left: 25px;
		padding: 15px;
		background: #f8f9fd;
		margin-top: 20px;
	}
	.daizhifu p{
		border-bottom: 1px solid #cdd9e6;
		line-height: 35px;
		margin-bottom: 5px;
	}
	.daizhifu >span{
		font-size: 22px;color:#f96b6b;
	}
	.daizhifu >span span{
		position: relative;top: 3px;
		margin-left: 5px;
	}
	.daizhifu i span{
		margin: 0 10px;
	}
	.add h3{
		font-size: 16px;
		font-weight: normal;
	}
	.wuliB{
		float: left;width: 480px;margin-top: 18px;
	}

	.wuliB .el-textarea__inner{
		height: 94px;
	}
	.search-btn{
		margin-top: 20px;
		clear: both;
	}
	.el-col-11{
		width: 300px;
	}
	.specific-search .el-select{
		width: 300px;
	}
	.upload-demo{
		margin-left: 100px;
	}
	.search-openBtn{
		color:#93a6b7;
	}
	.orderApplySpecial{
		background: #DD0000;
		color: #fff;
	}
	.orderApplySpecial:hover{
		color: #fff!important;
	}
</style>
